culturefandomcom-20200222-history
Mastermind (board game)
Mastermind or Master Mind is a code-breaking game for two players. The modern game with pegs was invented in 1970 by Mordecai Meirowitz, an Israeli postmaster and telecommunications expert.12 It resembles an earlier pencil and paper game called Bulls and Cows that may date back a century or more. Contents 1 Gameplay and rules 2 History 3 Algorithms 3.1 Five-guess algorithm 3.2 Genetic algorithm 3.3 Complexity and the satisfiability problem 4 Variations 5 Clones 6 See also 7 References 8 External links Gameplay and rules The game is played using: a decoding board, with a shield at one end covering a row of four large holes, and twelve (or ten, or eight, or six) additional rows containing four large holes next to a set of four small holes; code pegs of six (or more; see Variations below) different colors, with round heads, which will be placed in the large holes on the board; and key pegs, some colored black, some white, which are flat-headed and smaller than the code pegs; they will be placed in the small holes on the board. The two players decide in advance how many games they will play, which must be an even number. One player becomes the codemaker, the other the codebreaker. The codemaker chooses a pattern of four code pegs. Duplicates are allowed, so the player could even choose four code pegs of the same color. The chosen pattern is placed in the four holes covered by the shield, visible to the codemaker but not to the codebreaker.3 The codebreaker tries to guess the pattern, in both order and color, within twelve (or ten, or eight) turns. Each guess is made by placing a row of code pegs on the decoding board. Once placed, the codemaker provides feedback by placing from zero to four key pegs in the small holes of the row with the guess. A colored or black key peg is placed for each code peg from the guess which is correct in both color and position. A white key peg indicates the existence of a correct color code peg placed in the wrong position.4 Screenshot of software implementation (ColorCode) illustrating the example. If there are duplicate colours in the guess, they cannot all be awarded a key peg unless they correspond to the same number of duplicate colours in the hidden code. For example, if the hidden code is white-white-black-black and the player guesses white-white-white-black, the codemaker will award two colored key pegs for the two correct whites, nothing for the third white as there is not a third white in the code, and a colored key peg for the black. No indication is given of the fact that the code also includes a second black.5 Once feedback is provided, another guess is made; guesses and feedback continue to alternate until either the codebreaker guesses correctly, or twelve (or ten, or eight) incorrect guesses are made. The codemaker gets one point for each guess a codebreaker makes. An extra point is earned by the codemaker if the codebreaker doesn't guess the pattern exactly in the last guess. (An alternative is to score based on the number of colored key pegs placed.) The winner is the one who has the most points after the agreed-upon number of games are played. Other rules may be specified.6 History A game called 'Moo' was used on the Cambridge Titan shared computer system to help develop security applications by tempting hackers to modify the 'Moo League' of scores as a harmless diversion. The game involved guessing four numbers, scoring 'Bulls' or 'Cows' for correct numbers in the right or wrong places. Dr John Billingsley perceived that the game could be played equally effectively by his children with pencil and paper. Some time before 1976 he was engaged in a consultancy with Invicta Plastics, whose products at the time featured plastic inserts for footwear. He was asked if he could think of a game that could use their technology and the game of Moo sprang to mind. At the time, the TV quiz show Mastermind was in vogue and he suggested that name, never believing that it would be permitted. He influenced the design of the board, insisting that the 'results' pegs should be arranged in a square rather than in a line, to avoid each result being associated with a particular guess peg. Thinking that the game was 'public domain' or that the rights belonged elsewhere, he was unwilling to make any claim for it. Since 1971, the rights to Mastermind have been held by Invicta Plastics of Oadby, near Leicester, UK. (Invicta always named the game Master Mind.) They originally manufactured it themselves, though they have since licensed its manufacture to Hasbro worldwide, with the exception of Pressman Toys and Orda Industries who have the manufacturing rights to the United States and Israel, respectively.7 Starting in 1973, the game box featured a photograph of a well-dressed, distinguished-looking man seated in the foreground, with a woman standing behind him. The two amateur models (Bill Woodward and Cecilia Fung) reunited in June 2003 to pose for another publicity photo.8 Algorithms With four pegs and six colors, there are 64 = 1296 different patterns (allowing duplicate colors). Five-guess algorithm In 1977, Donald Knuth demonstrated that the codebreaker can solve the pattern in five moves or fewer, using an algorithm that progressively reduced the number of possible patterns.9 The algorithm works as follows: 1.Create the set S of 1296 possible codes (1111, 1112 ... 6665, 6666) 2.Start with initial guess 1122 (Knuth gives examples showing that other first guesses such as 1123, 1234 do not win in five tries on every code) 3.Play the guess to get a response of colored and white pegs. 4.If the response is four colored pegs, the game is won, the algorithm terminates. 5.Otherwise, remove from S any code that would not give the same response if it (the guess) were the code. 6.Apply minimax technique to find a next guess as follows: For each possible guess, that is, any unused code of the 1296 not just those in S, calculate how many possibilities in S would be eliminated for each possible colored/white peg score. The score of a guess is the minimum number of possibilities it might eliminate from S. A single pass through S for each unused code of the 1296 will provide a hit count for each colored/white peg score found; the colored/white peg score with the highest hit count will eliminate the fewest possibilities; calculate the score of a guess by using "minimum eliminated" = "count of elements in S" - (minus) "highest hit count". From the set of guesses with the maximum score, select one as the next guess, choosing a member of S whenever possible. (Knuth follows the convention of choosing the guess with the least numeric value e.g. 2345 is lower than 3456. Knuth also gives an example showing that in some cases no member of S will be among the highest scoring guesses and thus the guess cannot win on the next turn, yet will be necessary to assure a win in five.) 7.Repeat from step 3. Subsequent mathematicians have been finding various algorithms that reduce the average number of turns needed to solve the pattern: in 1993, Kenji Koyama and Tony W. Lai found a method that required an average of 5625/1296 = 4.340 turns to solve, with a worst-case scenario of six turns.10 The minimax value in the sense of game theory is 5600/1296 = 4.321.11 Genetic algorithm A new algorithm with an embedded genetic algorithm, where a large set of eligible codes is collected throughout the different generations. The quality of each of these codes is determined based on a comparison with a selection of elements of the eligible set.1213 This algorithm is based on a heuristic that assigns a score to each eligible combination based on its probability of actually being the hidden combination. Since this combination is not known, the score is based on characteristics of the set of eligible solutions or the sample of them found by the evolutionary algorithm. The algorithm works as follows: 1.Set i = 1 2.Play fixed initial guess G1 3.Get the response X1 and Y1 4.Repeat while Xi ≠ P: 1.Increment i 2.Set Ei = ∅ and h = 1 3.Initialize population 4.Repeat while h ≤ maxgen and |Ei| ≤ maxsize: 1.Generate new population using crossover, mutation, inversion and permutation 2.Calculate fitness 3.Add eligible combinations to Ei 4.Increment h 5.Play guess Gi which belongs to Ei 6.Get response Xi and Yi Complexity and the satisfiability problem In November 2004, Michiel de Bondt proved that solving a Mastermind board is an NP-complete problem when played with n pegs per row and two colors, by showing how to represent any one-in-three 3SAT problem in it. He also showed the same for Consistent Mastermind (playing the game so that every guess is a candidate for the secret code that is consistent with the hints in the previous guesses).14 The Mastermind satisfiability problem is a decision problem that asks, "Given a set of guesses and the number of colored and white pegs scored for each guess, is there at least one secret pattern that generates those exact scores?" (If not, then the codemaker must have incorrectly scored at least one guess.) In December 2005, Jeff Stuckman and Guo-Qiang Zhang showed in an arXiv article that the Mastermind satisfiability problem is NP-complete.15 Variations Varying the number of colors and the number of holes results in a spectrum of Mastermind games of different levels of difficulty. Another common variation is to support different numbers of players taking on the roles of codemaker and codebreaker. The following are some examples of Mastermind games produced by Invicta, Parker Brothers, Pressman, Hasbro, and other game manufacturers: Game Year Colors Holes Comments Mastermind 1972 6 4 Original version Royale Mastermind 1972 5 colors × 5 shapes 3 Mastermind44 1972 6 5 For four players Grand Mastermind 1974 5 colors × 5 shapes 4 Super Mastermind (a.k.a. Deluxe Mastermind; a.k.a. Advanced Mastermind) 1975 (in Poland - Copyright Invicta 1972 in cooperation with Krajowa Agencja Wydawnicza - https://boardgamegeek.com/image/281994/ultimate-mastermind?size=large) 8 5 Word Mastermind 1975 26 letters 4 Only valid words may be used as the pattern and guessed each turn. Number Mastermind 1976 6 digits 4 Uses numbers instead of colors. The codemaker may optionally give, as an extra clue, the sum of the digits. Electronic Mastermind (Invicta) 1977 10 digits 3, 4, or 5 Uses numbers instead of colors. Handheld electronic version. Solo or multiple players vs. the computer. Invicta branded. Walt Disney Mastermind 1978 5 3 Uses Disney characters instead of colors Mini Mastermind (a.k.a. Travel Mastermind) 1988 6 4 Travel-sized version; room for only six guesses Mastermind Challenge 1993 8 5 Both players simultaneously play code maker and code breaker. Parker Mastermind 1993 8 4 Mastermind for Kids 1996 6 3 Animal theme Mastermind Secret Search 1997 26 letters 3-6 Valid words only; clues are provided letter-by-letter using up/down arrows for earlier/later in the alphabet. Electronic Hand-Held Mastermind (Hasbro) 1997 6 4 Handheld electronic version. Hasbro. New Mastermind 2004 8 4 For up to five players Mini Mastermind 2004 6 4 Travel-sized self-contained version; room for only eight guesses Mastermind 2013 6 4 digital version The difficulty level of any of the above can be increased by treating “empty” as an additional color or decreased by requiring only that the code's colors be guessed, independent of position. Computer and Internet versions of the game have also been made, sometimes with variations in the number and type of pieces involved and often under different names to avoid trademark infringement. Mastermind can also be played with paper and pencil. There is a numeral variety of the Mastermind in which a 4-digit number is guessed.16 Clones There are at least four open-source software implementations of the game concept: colorcode uses Qt17 gnome-mastermind uses GTK+18 GMastermind uses GNUstep19 Guess is part of Simon Tatham's Portable Puzzle Collection20 See also Bulls and cows References 1.Jump up ^ Nelson, Toby (9 March 2000). "A Brief History of the Master Mind Board Game". Retrieved 6 August 2014. 2.Jump up ^ "Mastermind Board Game". Board Game Geek. Retrieved 6 August 2014. 3.Jump up ^ "Industrious". Retrieved 2014-07-07. 4.Jump up ^ "Wolfram". Retrieved 2012-07-09. 5.Jump up ^ "Archimedes". Retrieved 2012-10-07. 6.Jump up ^ "Bulls and Cows & co.". Retrieved 2012-07-07. 7.Jump up ^ "Invicta Toy History page". Retrieved 2012-08-07. 8.Jump up ^ "Landmark Reunion for Mastermind Box Models". Retrieved 2006-10-05. 9.Jump up ^ Knuth, Donald (1976–77). "The Computer as Master Mind" (PDF). J. Recr. Math. (9): 1–6. 10.Jump up ^ Koyama, Kenji; Lai, Tony (1993). "An Optimal Mastermind Strategy". Journal of Recreational Mathematics (25): 230–256. 11.Jump up ^ Knuth, Donald (2011). Selected papers on fun and games. Center for the Study of Language and Information. p. 226. ISBN 9781575865843. 12.Jump up ^ Berghman, Lotte (2007–2008). "Efficient solutions for Mastermind using genetic algorithms" (PDF). K.U.Leuven (1): 1–15. 13.Jump up ^ Merelo, J. J.; Mora, A. M.; Cotta, C.; Runarsson, T. P. (2012). "An experimental study of exhaustive solutions for the Mastermind puzzle". arXiv:1207.1315free to read. 14.Jump up ^ De Bondt, Michiel C. (November 2004). "NP-completeness of Master Mind and Minesweeper". Radboud University Nijmegen. 15.Jump up ^ Mastermind is NP-Complete Retrieved 2010-09-02. 16.Jump up ^ "Bulls and Cows Classic". 17.Jump up ^ http://packages.debian.org/jessie/colorcode 18.Jump up ^ http://packages.debian.org/jessie/gnome-mastermind 19.Jump up ^ "GMastermind - GNUstep Mastermind Implementation", GNUstep Application Project, 15 July 2011. 20.Jump up ^ Simon Tatham's Portable Puzzle Collection External links Mastermind: An augment reality approach, Porting a Legacy Game to New Interaction Paradigm Mathworld article on Mastermind Continuator of the game Supermind Mastermind program in C Mastermind for mobile devices (pure js no plugin required) Online Mastermind for colorblind people Online demonstration of a 6-move guarantee for (7,5) Mastermind Mastermind puzzle Classical Mastermind Strategies Algorithm::Mastermind is a Perl module with several algorithms that solve Mastermind, including Knuth's and an evolutionary algorithm. Category:Board games introduced in 1970 Category:1970s toys Category:Abstract strategy games Category:Games of mental skill Category:Logic puzzles Category:NP-complete problems Category:Deduction board games Category:Parker Brothers games Category:Israeli inventions Category:Pressman Toy Corporation games